<?php
/**
 * Created by PhpStorm.
 * User: FDG296
 * Date: 2017/7/10
 * Time: 15:33
 */
namespace common\models;

use Yii;
use yii\db\ActiveRecord;

class BuySet extends ActiveRecord{
    public static function tableName(){
        return '{{%buy_set}}';
    }

    //获取进口家具搭配套餐
    public function getMatchList(){
        $where = ['use_flg'=>1];
        $result = $this::find()->where($where)->limit(3)->orderBy('sort asc')->asArray()->all();
        return $result;
    }

    //获取进口家具搭配套餐
    public function getMatchListById($id){
        $where = ['use_flg'=>1,'id'=>$id];
        $result = $this::find()->where($where)->orderBy('sort asc')->asArray()->one();
        return $result;
    }
}